<?php
/**
 * View para vídeo do Youtube
 * @param int OPCIONAL $altura
 * @param int OPCIONAL $largura
 * @param String $url
 */
if(!empty($this->url)){
	$altura = (empty($this->altura)) ? 300 : $this->altura;
	$largura = (empty($this->largura)) ? 400 : $this->largura;
	preg_match('/[\\?&]v=([^&#]*)/', $this->url, $youtubeId);
	if (!strstr($this->url, 'vimeo')) {
?>
<object style="height: <?php echo $altura;?>px; width: <?php echo $largura;?>px;">
	<param name="movie"
		value="http://www.youtube.com/v/<?php echo $youtubeId[1];?>?version=3">
	<param name="allowFullScreen" value="true">
	<param name="allowScriptAccess" value="always">
	<embed src="http://www.youtube.com/v/<?php echo $youtubeId[1];?>?version=3"
	 wmode="transparent" type="application/x-shockwave-flash"
	 allowfullscreen="true" allowScriptAccess="always"
	 width="<?php echo $largura; ?>" height="<?php echo $altura; ?>">
</object>
<?php
	 
	}
	else {
?>
		<iframe src="<?php echo $this->url;?>" width="<?php echo $largura;?>" height="<?php echo $altura;?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<?php
	}

}
?>